import java.util.Observable;

public class Model_Model extends Observable {
	public final int BALL_SIZE = 20;

	private final Model_Model data = new Model_Model();
	private int xPosition;
	private int yPosition;
	private int xLimit, yLimit;
	private int xDelta = 6;
	private int yDelta = 4;

	public void setLimit(int xLimit, int yLimit) {
		this.xLimit = xLimit - BALL_SIZE;
		this.yLimit = yLimit - BALL_SIZE;
	}

	public int getX() {

		return xPosition;
	}

	public int getY() {
		return yPosition;
	}

	public void make_makeOneStep() {
		xPosition += xDelta;
		if (xPosition < 0 || xPosition >= xLimit) {
			xDelta = -xDelta;
			xPosition += xDelta;
		}
		yPosition += yDelta;
		if (yPosition < 0 || yPosition >= yLimit) {
			yDelta = -yDelta;
			yPosition += yDelta;
		}
		setChanged();
		notifyObservers();
	}

}
